<template>
	<view class="f24r col363636">
		<view class="pt10r pl10r borB1SE8e8e8">
			<button class="w160r borRad10r lh70r colFff f26r disInBlo backCol409EFF"
				@click="cliAddPackageBtn"
			>
				新增套餐
			</button>
		</view>
		<view class="pl20r pr20r">
			<view class="mt20r borRad10r bSha0010u0rgb00001 backImgLiGrTBDeedfdaFff overHid"
				v-for="item in tempList" :key="item.id"
				@click="modifyPackage(item)"
			>
				<view class="f26r foWeiBold lh70r  pl20r pr20r">
					{{item.name}}
				</view>
				<view class="pl20r pr20r">
					<view class="disFlex lh50r">
						<view class="flex1">
							<text class="col7a7a7a">
								套餐id：
							</text>
							{{item.id}}
						</view>
						<view class="flex1 teAliRight">
							<text class="col7a7a7a">
								房间rid：
							</text>
							{{item.rid}}
						</view>
					</view>
				</view>
				<view class="pl20r pr20r">
					<view class="disFlex lh50r">
						<view class="flex1 col7a7a7a">
							启用/禁用：
							<text :class="item.type == 1 ? 'col47ce68' : 'colC72d21'">
								{{
									item.type == 1 ? '启用' :
									item.type == 2 ? '禁用' : item.type
								}}
							</text>
						</view>
						<view class="flex1 teAliRight">
							<text class="col7a7a7a">
								套餐价格：
							</text>
							<text class="colCe2e37">
								¥{{item.price}}
							</text>
						</view>
					</view>
				</view>
			</view>
			<view class="lh100r teAliCenter col999">
				已加载全部
			</view>
		</view>
	</view>
</template>
<script>
import { inquiryToLogin } from '@/utils/utils.js'
import { getTeaSetmealList } from '@/utils/api.js'
export default {
	data() {
		return {
			token: '',
			tempList: [],
		}
	},
	onLoad() {
		
	},
	onShow() {
		inquiryToLogin().then(res => {
			this.token = res;
			this.getDataList1();
		});
	},
	onPullDownRefresh() {
		this.getDataList1(() => {
			uni.stopPullDownRefresh();
		});
	},
	methods: {
		getDataList1(callBack) {
			uni.showLoading({ title: '加载中...' })
			getTeaSetmealList({token: this.token}).then(res1 => {
				if(res1.data && res1.data.length) {
					this.tempList = res1.data;
				}
				uni.hideLoading();
				if(callBack) callBack();
			})
		},
		cliAddPackageBtn() {
			uni.navigateTo({
				url: '/pages/index/addPackageDetail?type=1'
			})
		},
		modifyPackage(data) {
			uni.navigateTo({
				url: '/pages/index/addPackageDetail?type=2&data=' + JSON.stringify(data)
			})
		}
	}
}
</script>
<style>
</style>